# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=giflib
pkgver=5.2.1
pkgrel=5
pkgdesc="A library for reading and writing GIF images"
url="https://sourceforge.net/projects/giflib/"
arch="all"
license="MIT"
subpackages="$pkgname-static $pkgname-dev $pkgname-doc $pkgname-utils"
makedepends="xmlto"
checkdepends="coreutils"
source="https://downloads.sourceforge.net/sourceforge/giflib/giflib-$pkgver.tar.gz
	CVE-2022-28506.patch
	giflib-restore-deprecated-functions.patch
	"

# secfixes:
#   5.2.1-r2:
#     - CVE-2022-28506

build() {
	make CFLAGS="$CFLAGS -fPIC"
}

check() {
	make check
}

package() {
	make DESTDIR="$pkgdir" PREFIX=/usr install
}

utils() {
	pkgdesc="Programs for manipulating GIF format image files"

	amove usr/bin
}

sha512sums="
4550e53c21cb1191a4581e363fc9d0610da53f7898ca8320f0d3ef6711e76bdda2609c2df15dc94c45e28bff8de441f1227ec2da7ea827cb3c0405af4faa4736  giflib-5.2.1.tar.gz
1742eb5006628de4b4578fa4920b9ea849f4d340900f8acb1bf825d9d5041941770a2c21a2fadc467e8185696e9592d05486bfdcdd7102dba6f2eb18b5142410  CVE-2022-28506.patch
fdc4a46e4a61e15e14ad712f164a3595902da700c3280ef3ec6fae345118c055eefb1eb73bb755078d0ea1f6112fa4a2b8edf9d918017e0bdf413497d15e1eaf  giflib-restore-deprecated-functions.patch
"
